package nc.ui.test.borrow.ace.serviceproxy;

import nc.bs.framework.common.NCLocator;
import nc.itf.test.IBorrowMaintain;
import nc.ui.pubapp.billref.src.RefContext;
import nc.ui.pubapp.uif2app.query2.model.IRefQueryService;
import nc.ui.querytemplate.querytree.IQueryScheme;

public class QueryForAHH2Service implements IRefQueryService{

	private RefContext refContext;
	
	@Override
	public Object[] queryByWhereSql(String condition) throws Exception {
		
		IBorrowMaintain query = NCLocator.getInstance().lookup(IBorrowMaintain.class);
		return query.queryForAHH2(condition);
	}

	@Override
	public Object[] queryByQueryScheme(IQueryScheme paramIQueryScheme)
			throws Exception {
		
		String condition = null;
		
		if(paramIQueryScheme.getWhereSQLOnly() == null){
			condition = "1=1";
		}else{
			condition = paramIQueryScheme.getWhereSQLOnly();
		}
		
		return queryByWhereSql(condition);
		
		
		
		
		
		
		
		
		
		
		
		
		
//		IBorrowMaintain query = NCLocator.getInstance().lookup(
//				IBorrowMaintain.class);
//		QueryScheme qs = new QueryScheme();
//		FromWhereSQL fws = new FromWhereSQLImpl();
//		qs.put("tablejoin", fws);
//		getRefContext().getRefBill().getRefBillModel().setQueryScheme(qs);
		
//		return query.query(paramIQueryScheme);
	}

	public RefContext getRefContext() {
		return refContext;
	}

	public void setRefContext(RefContext refContext) {
		this.refContext = refContext;
	}

}
